#include "..\dxstdafx.h"
#include "PAKWriter.h"
#include "DeclarationManager.h"

namespace ds {

class ShaderDecl : public ResourceDeclaration {

typedef std::vector<ResourceDeclaration*> ParameterDeclarations;

public:
	//ShaderDecl() : ResourceDeclaration() {}
	ShaderDecl(const std::string& name,const std::string& material,const std::string& file,const std::string& technique) 
		: ResourceDeclaration(name) , m_Name(name) , m_Material(material) , m_File(file) , m_Technique(technique) {}
	virtual ~ShaderDecl() {}
	void parseCategory(Category* category) {}
	void createResource();
	DeclarationType getType() const {
		return DT_SHADER;
	}	
	std::string& getName() {
		return m_Name;
	}
	void setTexture(const std::string& texture) {
		m_Texture = texture;
	}
	void addParameter(ResourceDeclaration* declaration) {
		m_Parameters.push_back(declaration);
	}
private:
	std::string m_Name;
	std::string m_Material;
	std::string m_File;
	std::string m_Technique;
	std::string m_Texture;
	ParameterDeclarations m_Parameters;
};

class ShaderParser : public DeclarationParser {

public:
	ShaderParser() {}
	virtual ~ShaderParser() {}
	ResourceDeclaration* loadTextFile(const ResourceFile& resourceFile);
	void loadTextFile(const ResourceFile& resourceFile,DeclarationManager* declarationManager);
	void createResource(ResourceDeclaration* declaration);
	DeclarationType getType() const {
		return DT_SHADER;
	}
	bool isSupported(const std::string& fileEnding) const {
		return fileEnding == ".shaders";
	}
	bool isReloadable() const {
		return false;
	}	
private:
	ResourceDeclaration* parseCategory(Category* category);
};

}